//
//  ViewController.m
//  Demo_EncryptAndDecrypt
//
//  Created by 陈冰 on 2020/3/9.
//  Copyright © 2020 ChenBing. All rights reserved.
//

#import "ViewController.h"
#import "EDEncryptRSA.h"
#import "EDEncryptAES.h"
#import "EDEncryptMD5.h"
#import "NSData+EDEncode.h"
#import "NSString+EDEncode.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    NSString *key = @"1234567890";
    NSString *iv = @"0987654321";
    
    NSString *origStr = @"我是原始数据";
    
    NSData *result = [EDEncryptAES ed_dataByEncrypt:origStr.ed_utf8Data key:key mode:EDEncryptAES128 options:kCCOptionPKCS7Padding | kCCOptionECBMode iv:nil];
    NSString *resultStr = result.ed_base64Encode.ed_utf8String;
    NSLog(@"AES128 ECB 加密 %@", resultStr);

    NSData *result2 = [EDEncryptAES ed_dataByEncrypt:origStr.ed_utf8Data key:key mode:EDEncryptAES192 options:kCCOptionPKCS7Padding iv:iv];
    NSString *resultStr2 = result2.ed_base64Encode.ed_utf8String;
    NSLog(@"AES192 CBC 加密 需要偏移量iv %@", resultStr2);
    
    NSString *resultStr3 = [EDEncryptAES stringByAes256Encrypt:origStr key:key];
    NSLog(@"AES256 ECB 加密 %@", resultStr3);
}


@end
